//意向产品跟进
@isTest
private class IntentionalProductMonthControllerTest {
    static testMethod void testMethod1() {
        // 客户
        Account acc = TestUtils.createAccount();
        acc.Level__c = '一级医院';
        insert acc;

        // 业务机会
        Opportunity opp = TestUtils.createOpportunity();
        opp.AccountId = acc.Id;
        insert opp;

        // 产品
        Product__c p = TestUtils.createProduct();
        p.Purpose__c = '仪器报价用';
        p.Category3__c = '仪器';
        p.Category0__c = '仪器';
        p.RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('NCProduct', 'Product__c');
        insert p;


         IntentProduct__c ip = new IntentProduct__c();
        ip.Product__c = p.Id;
        ip.Quantity__c = 1;
        ip.SalesPrice__c = 1;
        ip.Opportunity__c = opp.Id;
        insert ip;


        Event e = new Event();
        e.Opportunity__c  = opp.Id;
        e.DurationInMinutes = 100;
 		e.ActivityDateTime = System.now();
        insert e ;




         // ---------------------新建-----------------------
        PageReference page = new PageReference('/apex/IntentionalProduct?id='+e.Id);
        System.Test.setCurrentPage(page);

        IntentionalProductMonthController ipc = new IntentionalProductMonthController();
        ipc.init();
        ipc.saveJson = ipc.dataJson;
        System.debug('IntentionalProductMonthControllerTest==>'+EncodingUtil.urlDecode(ipc.saveJson, 'UTF-8'));

        ipc.save();

        //编辑
        PageReference page1 = new PageReference('/apex/IntentionalProduct?id='+opp.Id);
        System.Test.setCurrentPage(page1);

        IntentionalProductMonthController ipc1= new IntentionalProductMonthController();
        ipc1.init();

    }
}